#ifndef __X_OBJECT_H__
#define __X_OBJECT_H__

class xObject
{
protected:
    unsigned int _reference;

public:
    xObject(void);
    virtual ~xObject(void);

    void release(void);
    void retain(void);

    virtual bool isEqual(const xObject *object);
};

xObject::xObject(void)
: _reference(1) // when the object is created, the reference count is 1
{

}

xObject::~xObject(void)
{

}

void xObject::release(void)
{
    --_reference;
   
    if (_reference == 0)
    {
        delete this;
    }
}

void xObject::retain(void)
{
    ++_reference;
}

bool xObject::isEqual(const xObject *object)
{
    return this == object;
}

#endif // __X_OBJECT_H__